package com.huixh.train.common.resp;

import java.io.Serializable;
import java.util.List;

/**
 * @author huixh
 */
public class PageResult<T> extends Result<T> implements Serializable {

    private Long total;

    public PageResult() {
    }

    public PageResult(boolean success, String message, T data, Long total) {
        super(success, message, data);
        this.total = total;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }


    public static <T extends List<?>> PageResult<T> success(Long total, T dataList) {
        return new PageResult<>(true, "success", dataList, total);
    }

    public static <T extends List<?>> PageResult<T> success(Long total, T dataList, String msg) {
        return new PageResult<>(true, msg, dataList, total);
    }
}
